package com.mind.adjust.service.impl;

import com.mind.system.domain.AjAttachCateBusiness;
import com.mind.adjust.mapper.AjAttachCateBusinessMapper;
import com.mind.adjust.service.AjAttachCateBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 业务小类(AjAttachCateBusiness)表服务实现类
 *
 * @author makejava
 * @since 2024-07-28 22:05:30
 */
@Service("attachCateBusinessService")
public class AjAttachCateBusinessServiceImpl implements AjAttachCateBusinessService {
    @Autowired
    private AjAttachCateBusinessMapper attachCateBusinessMapper;

    /**
     * 查询业务小类信息集合
     * 
     * @param attachCateBusiness 业务小类信息
     * @return 业务小类信息集合
     */
    @Override
    public List<AjAttachCateBusiness> selectAttachCateBusinessList(AjAttachCateBusiness attachCateBusiness)
    {
        return attachCateBusinessMapper.selectAttachCateBusinessList(attachCateBusiness);
    }

    /**
     * 通过业务小类ID查询业务小类信息
     * 
     * @param attachCateBusinessId 业务小类ID
     * @return 角色对象信息
     */
    @Override
    public AjAttachCateBusiness selectAttachCateBusinessById(Long attachCateBusinessId)
    {
        return attachCateBusinessMapper.selectAttachCateBusinessById(attachCateBusinessId);
    }

    /**
     * 删除业务小类信息
     * 
     * @param attachCateBusinessId 业务小类ID
     * @return 结果
     */
    @Override
    public int deleteAttachCateBusinessById(Long attachCateBusinessId)
    {
        return attachCateBusinessMapper.deleteAttachCateBusinessById(attachCateBusinessId);
    }

    /**
     * 批量删除业务小类信息
     * 
     * @param attachCateBusinessIds 需要删除的业务小类ID
     * @return 结果
     */
    @Override
    public int deleteAttachCateBusinessByIds(Long[] attachCateBusinessIds)
    {
        return attachCateBusinessMapper.deleteAttachCateBusinessByIds(attachCateBusinessIds);
    }

    /**
     * 新增保存业务小类信息
     * 
     * @param attachCateBusiness 业务小类信息
     * @return 结果
     */
    @Override
    public int insertAttachCateBusiness(AjAttachCateBusiness attachCateBusiness)
    {
        return attachCateBusinessMapper.insertAttachCateBusiness(attachCateBusiness);
    }

    /**
     * 修改保存业务小类信息
     * 
     * @param attachCateBusiness 业务小类信息
     * @return 结果
     */
    @Override
    public int updateAttachCateBusiness(AjAttachCateBusiness attachCateBusiness)
    {
        return attachCateBusinessMapper.updateAttachCateBusiness(attachCateBusiness);
    }
    
    /**
     * 批量插入
     *
     * @param attachCateBusinessList 附件类型信息
     * @return 结果
     */
    @Override
    public int batchInsert(List<AjAttachCateBusiness> attachCateBusinessList) {
        int size = 0;
        for(AjAttachCateBusiness attachCateBusiness: attachCateBusinessList) {
            if (attachCateBusinessMapper.selectAttachCateBusinessByName(attachCateBusiness.getName()) == null){
                attachCateBusinessMapper.insertAttachCateBusiness(attachCateBusiness);
                size ++;
            }
        }
        return size;
    }
}
